import Request from '@/libs/service/index';

import type {IResult,IListResult } from './type';
import { BASE_URL } from '../../request/config';
import { IHouseForm } from '@/libs/type/house';

enum LoginAPI {
    ProductList = '/product/list',
    ProductAdd = '/product/add',
    ProductUpdate = '/product/update',
    ProductRemove = '/product/remove',
}

export function productListRequest(obj: IHouseForm) {
    return Request.post<IListResult>({
        url: BASE_URL + LoginAPI.ProductList,
        data: obj,
    });
}

export function productAddRequest(obj: IHouseForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.ProductAdd,
        data: obj,
    });
}

export function productUpdateRequest(obj: IHouseForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.ProductUpdate,
        data: obj,
    });
}

export function productRemoveRequest(obj: IHouseForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.ProductRemove,
        data: obj,
    });
}